
#pragma once


/* #include <cstdint> */
#include <memory>
#include <functional>
#include <string>
#include <arpa/inet.h>

using WriteAbleCallback = std::function<void()>;
using ReadAbleCallback  = std::function<void(int64_t)>;
using ErrorCallback     = std::function<void(int64_t,int)>;
using TaskCallback      = std::function<void()>;

using DecodecCallback   = std::function<void(const uint8_t * data, int length)>;

struct UdpPacket
{
    uint8_t * data;
    int       length;
    struct sockaddr_in sai;
};

class DataBuffer;

struct UdpBufferPacket
{
    DataBuffer * buffer;
    struct sockaddr * sai;
    socklen_t sai_len;
};

using OnUdpMessage = std::function<void(UdpPacket*)>;
using OnUdpPacketMessage = std::function<void(UdpBufferPacket*)>;

enum CONNECTION_STATUS 
{
    em_unknown    = 0x00,
    em_connecting = 0x01,
    em_connected  = 0x02,
    em_closed     = 0x03,
};
